var axios = require('axios');
const schedule = require('node-schedule');

axios.defaults.headers.post['Content-Type'] = 'application/json';


// 钉钉推送机器人
const  roboters = {
  "吴彦祖和他的跟班": 'https://oapi.dingtalk.com/robot/send?access_token=6f2532f2b98e36353ab8ea9c5e8148c869ab01cf79a94f1ee97cfe4050e54add',
  "开奖了-TEST": 'https://oapi.dingtalk.com/robot/send?access_token=f7b3acd5baa1b01e4f5b665871b0ae3fc45364c458eacc8f14682b62d2874d9c',
  // 阿里88股份有限公司
  "多粉最大彩票投注站": 'https://oapi.dingtalk.com/robot/send?access_token=bb6bc1dc35ec396c149c2b11ebd5b749aced6b6b89b770b9203e937448ee076a'
}

function sendMsg(roboter, msg, options) {
  let data = {
    "msgtype": "text",
      "text": {
          "content": `${msg}`
      },
      ...options
  }
  axios.post(roboters[roboter], data).then(() => {
    console.log('推送消息成功',data)
  }).catch(err => {
    console.error(err)
  })
}


module.exports = {
  roboters,
  sendMsg
}
